home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / source / kernel / imf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-26  |  3.2 KB  |  113 lines  |  [TEXT/KAHL]

  1. /* Definitions for Xconq images.
  2.    Copyright (C) 1992, 1993, 1994 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. /* An image family is like a finder icon family, but allows multiple kinds
  10.    of images of an arbitrary set of sizes. */
  11.  
  12. typedef struct a_image {
  13.     int w, h;
  14.     int minw, minh;
  15.     int maxw, maxh;
  16.     int istile;
  17.     char *embedname;
  18.     int embedx, embedy;
  19.     int embedw, embedh;
  20.     Obj *monodata;
  21.     Obj *colrdata;
  22.     Obj *maskdata;
  23.     int actualw, actualh;
  24.     int pixelsize;
  25.     int rowbytes;
  26.     Obj *palette;
  27.     char *rawmonodata;
  28.     char *rawcolrdata;
  29.     char *rawmaskdata;
  30.     int *rawpalette;
  31.     int numcolors;
  32.     char *hook;
  33.     struct a_image *next;
  34. } Image;
  35.  
  36. typedef struct a_image_family {
  37.     char *name;            /* Name of the family */
  38.     int ersatz;            /* True if this image is a substitute */
  39.     struct a_image_file *location;  /* File or whatever to look for data */
  40.     int numsizes;        /* Number of images in the list */
  41.     Image *images;
  42. } ImageFamily;
  43.  
  44. /* (should add a palette structure) */
  45.  
  46. typedef struct a_image_color {
  47.     char *name;            /* Name of the color */
  48.     struct a_image_file *location;  /* File or whatever to look for data */
  49.     int defined;
  50.     short r, g, b;
  51. } ImageColor;
  52.  
  53. typedef struct a_image_file {
  54.     char *name;
  55.     int loaded;
  56.     struct a_image_file *next;
  57. } ImageFile;
  58.  
  59. enum {
  60.     K_MONO_,
  61.     K_MASK_,
  62.     K_COLR_,
  63.     K_OTHER_
  64. };
  65.  
  66. extern ImageFamily **images;
  67.  
  68. extern int numimages;
  69.  
  70. extern ImageColor **colors;
  71.  
  72. extern int numcolors;
  73.  
  74. extern ImageFile *image_files;
  75.  
  76. #define hextoi(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'a' + 10))
  77.  
  78. ImageFamily *new_imf PROTO ((char *name));
  79. ImageFamily *clone_imf PROTO ((ImageFamily *imf));
  80. ImageFamily *get_imf PROTO ((char *name));
  81. ImageFamily *find_imf PROTO ((char *name));
  82. Image *find_img PROTO ((ImageFamily *imf, int w, int h));
  83. Image *get_img PROTO ((ImageFamily *imf, int w, int h));
  84. int valid_imf_name PROTO ((char *name));
  85.  
  86. ImageColor *new_image_color PROTO ((char *name));
  87. ImageColor *get_imc PROTO ((char *name));
  88. ImageColor *find_imc PROTO ((char *name));
  89.  
  90. void load_image_families PROTO ((FILE *fp, int loadnow,
  91.                 void (*callback)(ImageFamily *, int)));
  92. int load_imf_file PROTO ((char *filename,
  93.                void (*callback)(ImageFamily *, int)));
  94. void interp_imf_form PROTO ((Obj *form,
  95.                  void (*callback)(ImageFamily *, int)));
  96.  
  97. ImageFamily *interp_imf PROTO ((Obj *form));
  98. void interp_imf_contents PROTO ((ImageFamily *imf, Obj *form));
  99. void interp_image PROTO ((ImageFamily *imf, Obj *size, Obj *parts));
  100. void interp_bytes PROTO ((Obj *datalist, int numbytes, char *destaddr,
  101.               int jump));
  102. void interp_palette PROTO ((Obj *form));
  103. ImageColor *interp_color PROTO ((Obj *form));
  104.  
  105. Image *best_image PROTO ((ImageFamily *imf, int w, int h));
  106. int right_depth PROTO ((Image *img));
  107.  
  108. void sort_all_images PROTO ((void));
  109. void sort_all_colors PROTO ((void));
  110.  
  111. void write_imf PROTO ((FILE *fp, ImageFamily *imf));
  112. void write_imc PROTO ((FILE *fp, ImageColor *imc));
  113.